﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AdminPortal_Includes_LeftCategory : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

        }
    }
    protected void rptCategoryRoot_ItemDataBound(Object sender, RepeaterItemEventArgs e)
    {
        SiteMapNode _node = (SiteMapNode)e.Item.DataItem;
        HyperLink LnkCateHome = (HyperLink)e.Item.FindControl("LnkCateHome");
        Repeater rptCategoryFolder = (Repeater)e.Item.FindControl("rptCategoryFolder");
        if (_node == null) return;
        if (_node.ChildNodes.Count > 0)
        {
            LnkCateHome.Text = _node.Title;
            LnkCateHome.NavigateUrl = _node.Url;

            rptCategoryFolder.DataSource = _node.ChildNodes;
            rptCategoryFolder.DataBind();

        }
    }

    protected void rptCategoryFolder_ItemDataBound(Object sender, RepeaterItemEventArgs e)
    {
        SiteMapNode _node = (SiteMapNode)e.Item.DataItem;
        Label lblFolderName = (Label)e.Item.FindControl("lblFolderName");
        Repeater rptCategoryFiles = (Repeater)e.Item.FindControl("rptCategoryFiles");
        if (_node == null) return;
        if (_node.ChildNodes.Count > 0)
        {
            lblFolderName.Text = _node.Title;

            rptCategoryFiles.DataSource = _node.ChildNodes;
            rptCategoryFiles.DataBind();

        }
    }

    protected void rptCategoryFiles_ItemDataBound(Object sender, RepeaterItemEventArgs e)
    {
        SiteMapNode _node = (SiteMapNode)e.Item.DataItem;
        HyperLink LnkFileName = (HyperLink)e.Item.FindControl("LnkFileName");
        if (_node == null) return;
        LnkFileName.Text = _node.Title;
        LnkFileName.NavigateUrl = _node.Url;
    }
}